package com.boot.project.core.model.system.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.boot.project.core.model.base.BaseEntity;
import com.boot.project.core.model.system.dto.ResourceSaveDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

@TableName("sys_resource")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Resource extends BaseEntity {

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long parentId;
    private String name;
    private Integer type; // 1.菜单，2.按钮
    private String url;
    private String icon;
    private String permission;
    private Integer sort;

    private transient String checked;

    public Resource(ResourceSaveDto resourceSaveDto) {
        BeanUtils.copyProperties(resourceSaveDto, this);
    }
}
